package h0728;

import java.util.Arrays;
import java.util.Scanner;

/**
  * @description 小明找位置
  * @author 不知名帅哥
  * @date 2024/7/28 21:09
  * @version 1.0
*/
public class FindPosition {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] array = Arrays.stream(sc.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();
        int id= sc.nextInt();
        int index=getRes(array,id);
        int i = Arrays.binarySearch(array, id);//Arrays.binarySearch如果找不到返回-(插入点索引+1)
        System.out.println(i);
        System.out.println(index);
    }

    //二分法
    private static int getRes(int[] array, int id) {
        int left=0;
        int right= array.length;
        while (left<=right){
            int mid=left+(right-left)/2;
            if (array[mid]==id){
                return mid+1;
            }
            else if (array[mid]>id){
                right=mid-1;
            }else{
                left=mid+1;
            }
        }
        return left+1; //返回left的下标，由于是从1开始，所以
    }
}
